home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cocktail Hour
/
image.iso
/
TRIVIAEX.CST
/
00001_Script_trivia procedures
next >
Wrap
Text File
|
1996-03-03
|
6KB
|
184 lines
on hide toHide
set the visible of sprite toHide to FALSE
end
on show toShow
set the visible of sprite toShow to TRUE
end
------------------------ general TRIVIA -------------------------------------------------------------
on yossi triviaQuestMem, NumOfQuestions
global gTriviaQuestMem
global gNumOfQuestions
repeat with i=13 to 17
show i
end repeat
-- if the paramCount = 0 then
put "trivia base mat.1" into gTriviaQuestMem
put 40 into gNumOfQuestions
-- else
put TriviaQuestMem into gTriviaQuestMem
put NumOfQuestions into gNumOfQuestions
-- end if
initTrivia
showNextQuestion
end
on initTrivia
set the scrolltop of member "trivia base mat.1.board"=0
global gNumOfQuestions
global gQuestionsVec
global gRightAnswer
global gCluePointer
global gTriviaQuestMem
global TriviaCounter
set TriviaCounter=0
put [] into gQuestionsVec
repeat with i = 1 to gNumOfQuestions
--put i into item i of gQuestionsVec
add gQuestionsVec, i
end repeat
put 0 into field "score" of castLib "TriviaEx.cst"
put empty into field "trivia base mat.1.board" of castLib "TriviaEx.cst"
put EMPTY into gRightAnswer
put EMPTY into gCluePointer
end
on showNextQuestion
global gQuestionsVec
global gRightAnswer
global gCluePointer
global gTriviaQuestMem
global gNumOfQuestions
global TriviaCounter
set TriviaCounter=TriviaCounter+1
--put random(the number of items of gQuestionsVec) into temp
put random(count(gQuestionsVec)) into temp
--if QuestionToShow <> 0 then
if gQuestionsVec <> [] then
put value(getat(gQuestionsVec,temp)) into QuestionToShow
-- if TriviaCounter<41 then
--delete item temp of gQuestionsVec
deleteAt gQuestionsVec, temp
put item 1 of line QuestionToShow of field gTriviaQuestMem of castLib "TriviaEx.cst" into gRightAnswer
put item 2 of line QuestionToShow of field gTriviaQuestMem of castLib "TriviaEx.cst" into gCluePointer
set the itemDelimiter to "@"
put gTriviaQuestMem&".Ques" into tempor
put gTriviaQuestMem&".Board" into screenFld
hide 10
put item QuestionToShow of the text of member tempor of castLib "TriviaEx.cst" into field screenFld of castLib "TriviaEx.cst"
if offset("d. ",item QuestionToShow of the text of member tempor of castLib "TriviaEx.cst")=0 then
show 18
else
hide 18
end if
colorFld
show 10
set the itemDelimiter to ","
else
-- no more questions to be asked
put gTriviaQuestMem&".Board" into screenFld
put " try again !! "&RETURN&" questions will repeat !!" into x
put x into field screenFld of castLib "TriviaEx.cst"
startTimer
repeat while the timer <= 3*60
nothing
end repeat
-- delay 3*60
initTrivia
-- put value(the last char of gTriviaQuestMem) into xxx
-- if (the last char of gTriviaQuestMem) = 1 then initTrivia
showNextQuestion
end if
end
on colorFld
global gTriviaQuestMem
repeat with i =1 to the number of lines of field (gTriviaQuestMem&".Board")
case i of
2,3: set the forecolor of line i of field (gTriviaQuestMem&".Board") to 71
4,5,6,7,8: set the forecolor of line i of field (gTriviaQuestMem&".Board") to 237
end case
end repeat
end
on CheckAns userAns
global gQuestionsVec
global gTriviaQuestMem
global gRightAnswer
global gNumOfQuestions
global gCluePointer, gCurrentZone -- boolean, after all.
if not (the text of field "score" of castLib "TriviaEx.cst" = 10 and (the last char of gTriviaQuestMem) =1) then
if userAns= gRightAnswer then
puppetSound "clink"
set the text of field "score" of castLib "TriviaEx.cst" to string(value(the text of field "score" of castLib "TriviaEx.cst")+1)
-- play sound right ans
--
if the text of field "score" of castLib "TriviaEx.cst" = 10 and (the last char of gTriviaQuestMem) =1 then ----
puppetSprite 19,1
global OnceCheck
set OnceCheck=0
go to marker ("triviaAnim")
set the itemDelimiter to "@"
put gTriviaQuestMem&".Board" into screenFld
global Wins
set Wins=Wins+1
if Wins>3 then
put item random(3) of the text of member "triviaPrise" of castLib "TriviaEx.cst" into field screenFld of castLib "TriviaEx.cst"
else
put item Wins of the text of member "triviaPrise" of castLib "TriviaEx.cst" into field screenFld of castLib "TriviaEx.cst"
end if
--
global gTriviaQuestMem
if the scrollTop of member (gTriviaQuestMem&".Board")=0 then
repeat with i =1 to the number of lines of field (gTriviaQuestMem&".Board")
case i of
1,2,3,11: set the forecolor of line i of field (gTriviaQuestMem&".Board") to 71
--4,5,6,7,8,9,10,11,12: set the forecolor of line i of field (gTriviaQuestMem&".Board") to 237
otherwise set the forecolor of line i of field (gTriviaQuestMem&".Board") to 237
end case
end repeat
end if
--
set the visible of sprite 13=1
set the visible of sprite 14=1
set the itemDelimiter to ","
repeat with i=15 to 17
hide i
end repeat
set the visible of sprite 18=0
set the visible of sprite 21=1
set the visible of sprite 22=1
set the visible of sprite 23=1
set the visible of sprite 24=1
puppetSound 2,"yea"
-- showNextQuestion
else
showNextQuestion
end if
else
-- play sound wrong answer
showNextQuestion
end if
end if
end